package com.xiaoshuidi.cloud.module.contract.api.contract;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.contract.api.ContractOwnerOrderApi;
import com.xiaoshuidi.cloud.module.contract.service.bill.OwnerOrderService;
import com.xiaoshuidi.cloud.module.contract.vo.OwnerOrderTransferCallbackReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;
import static com.xiaoshuidi.cloud.module.contract.enums.ApiConstants.VERSION;

@Slf4j
@RestController
@Validated
@RequiredArgsConstructor
public class ContractOwnerOrderApiImpl implements ContractOwnerOrderApi {

    @Resource
    private OwnerOrderService ownerOrderService;

    @Override
    public CommonResult<Boolean> ownerContractCheckRentOut(Long orderId) {
        return success(ownerOrderService.checkOwnerOrderRentOut(orderId));
    }

    @Override
    public CommonResult<Void> ownerTransferCallback(OwnerOrderTransferCallbackReqVO reqVO) {
        ownerOrderService.transferCallback(reqVO);
        return success();
    }
}
